<template>
	<view id="tool">
		<Header txt="设置" v-if="baidu"></Header>
		<HeaderB txt="设置" v-if="!baidu"></HeaderB>
		<view class="content">
			<chunLei-modal :mData="defaultData" :value="isShow" @onConfirm="onConfirm" @cancel="cancel" navMask>
			 </chunLei-modal>
			<uni-list>
			    <uni-list-item title="关于我们" link="navigateTo" to="/pagesB/tool/about"  ></uni-list-item>
			    <uni-list-item title="修改密码" link="navigateTo" to="/pages/login/forgetPas"  ></uni-list-item>
			</uni-list>
			<button @click="Logout" type="default">退出登录</button>
		</view>
	</view>
</template>

<script>
	import TabMask from '../../components/chunLei-modal/tabMask.js'
	export default {
		data() {
			return {
				defaultData:{title:'退出登录',content:'真的要退出登陆吗？',cancelText:'取消',confirmColor:'#3CC51F'},
				isShow:false,
				baidu:true
			}
		},
		onShow(){
			// #ifdef MP-BAIDU
			this.baidu=false
			// #endif
		},
		methods: {				 
			Logout(){
				this.isShow=true
			},
			onConfirm(){
				this.isShow=false
				this.$store
				  .dispatch("LogOut",true)
				  .then((response) => {
					  console.log(123,response)
					  if(response.data.code==0){
						uni.removeStorageSync('Cookie');
						uni.switchTab({
							url: "/pages/user/user"
						})
					  }
				  })
				  .catch(() => {});
			},
			cancel(){
				this.isShow=false
			}
		}
	}
</script>

<style lang="less" scoped>
	#tool{
		overflow: hidden;
		.content{
			margin-top: 10rpx;
		}
		button{
			margin-top: 10rpx;
		}
	}

</style>
